#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
typedef struct{
	char mssv[10];
	char hoten[40];
	int tuoi;
	float toan,ly,hoa;
}sinhvien;
int main(){
	FILE * fileOut;
	FILE * fileIn;
	fileOut = fopen("output.txt","w");
	fileIn = fopen("input.txt","r");
	if(fileOut != NULL || fileIn != NULL){
		printf("Mo File thanh cong\n Bam phim bat ky de tiep tuc.");
		getch();
	}else{
		printf("Mo File khong thanh cong\n Bam phim bat ky de ket thuc.");
		getch();
		exit(0);
	}
	sinhvien sv[10];
	int sosv;
	fscanf(fileIn,"%d",&sosv);
	char ch;
	
	printf("\nSo Sinh Vien Trong Lop : %d",sosv);
	for(int i = 0; i < sosv ; i ++){
	//	fscanf(fileIn,"%c",&ch);
		fgets(sv[i].mssv,10,fileIn);
		fgets(sv[i].hoten,40,fileIn);
		fscanf(fileIn,"%d",&sv[i].tuoi);
		fscanf(fileIn,"%f",&sv[i].toan);
		fscanf(fileIn,"%f",&sv[i].ly);
		fscanf(fileIn,"%f",&sv[i].hoa);
	}
	printf("\n=================THONG TIN SINH VIEN DA NHAP (Screen) ==================\n");
	for(int i=0; i<sosv ; i++){
		printf("\nsinh vien thu %d: \n",i+1);
		printf("\n\tmssv:      %s",sv[i].mssv);
		printf("\n\tho va ten: %s",sv[i].hoten);
	    printf("\n\ttuoi:      %d",sv[i].tuoi);
	    printf("\n\tdiem toan: %f",sv[i].toan);
	    printf("\n\tdiem ly:   %f",sv[i].ly);
	    printf("\n\tdiem hoa:  %f",sv[i].hoa);
	    printf("\n");
	}
	fclose(fileOut);
	fclose(fileIn);
	getch();
}
